//
//  MainTabbarViewController.m
//  Lucky28
//
//  Created by zr on 2018/7/31.
//  Copyright © 2018年 zr. All rights reserved.
//

#import "MainTabbarViewController.h"
#import "HomeViewController.h"
#import "ClubViewController.h"
#import "PushTieZiViewController.h"
#import "MiniCirCleViewController.h"
#import "MyselfViewController.h"
#import "MainViewController.h"

@interface MainTabbarViewController ()

@end

@implementation MainTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}

- (void)setupUI{
    
    [[UITabBar appearance] setBarTintColor:[UIColor whiteColor]];
    
    [UITabBar appearance].translucent = NO;
    
    HomeViewController * homeVC = [HomeViewController new];
    homeVC.title = @"首页";
    
    ClubViewController * clubVC = [ClubViewController new];
    clubVC.title = @"社区";
    
    PushTieZiViewController * pushVC = [PushTieZiViewController new];
    pushVC.title = @"发帖";
    
    MiniCirCleViewController * circleVC = [MiniCirCleViewController new];
    circleVC.title = @"微圈";
    
    MyselfViewController * myselfVC = [MyselfViewController new];
    myselfVC.title = @"我的";
    
    
    MainViewController * homeNav = [[MainViewController alloc] initWithRootViewController:homeVC];
    MainViewController * clubNav = [[MainViewController alloc] initWithRootViewController:clubVC];
    MainViewController * pushNav = [[MainViewController alloc] initWithRootViewController:pushVC];
    MainViewController * circleNav = [[MainViewController alloc] initWithRootViewController:circleVC];
     MainViewController * myselfNav = [[MainViewController alloc] initWithRootViewController:myselfVC];
    
    homeNav.tabBarItem.image = [[UIImage imageNamed:@"jjj"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    homeNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"首页(1)"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    clubNav.tabBarItem.image = [[UIImage imageNamed:@"yyy"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    clubNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"社区(1)"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    pushNav.tabBarItem.image = [[UIImage imageNamed:@"fgfg"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    pushNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"发布"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    circleNav.tabBarItem.image = [[UIImage imageNamed:@"oo"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    circleNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"圈子点击"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    myselfNav.tabBarItem.image = [[UIImage imageNamed:@"fff"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    myselfNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"我的"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    
    //改变tabbarController 文字选中颜色(默认渲染为蓝色)
    [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor grayColor]} forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:MAINCOLOR} forState:UIControlStateSelected];
    
    //创建一个数组包含四个导航栏控制器
    NSArray *vcArry = [NSArray arrayWithObjects:homeNav,clubNav,pushNav,circleNav,myselfNav,nil];
    
    //将数组传给UITabBarController
    self.viewControllers = vcArry;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
